﻿using System;
using System.Collections.Generic;

namespace Compiler.LabLogic
{
    public class TestQuestion
    {
        public int Number;
        private readonly String _text;
        private readonly List<TestAnswer> _answers = new List<TestAnswer>(4);

        public TestQuestion(string text)
        {
            _text = text;
        }

        public string Text
        {
            get { return _text; }
        }

        public List<TestAnswer> Answers
        {
            get { return _answers; }
        }

        public TestQuestion AddAnswer(TestAnswer testAnswer)
        {
            _answers.Add(testAnswer);
            return this;
        }

        public TestAnswer GetRightAnswer()
        {
            foreach (var testAnswer in _answers)
            {
                if (testAnswer.Right)
                {
                    return testAnswer;
                }    
            }
            return null;
        }
    }

    public class TestAnswer
    {
        private readonly Boolean _right;
        private readonly string _text;

        public TestAnswer(string text, Boolean right)
        {
            _text = text;
            _right = right;
        }

        public bool Right
        {
            get { return _right; }
        }

        public string Text
        {
            get { return _text; }
        }
    }
}
